#include "MessageFactory.h"
#include <sstream>
#include "Message.h"
#include "../Core/PluginHandler.h"
#include "AddEvaluationSetMessage.h"

MessageFactory::MessageFactory(std::string pPluginDirectory) : mPluginDirectory(pPluginDirectory)
{
    //ctor
}

Message* MessageFactory::BuildMessage(std::string pMessage) {
    std::istringstream stream(pMessage);
    std::string tMessageCode;
    stream >> tMessageCode;

    ///TODO: Implement concrete classes
    Message *m = NULL;
    if (tMessageCode == "101") {
        m = new AddEvaluationSetMessage();
        m->ParseMessage(pMessage);

        //std::cout << ((AddEvaluationSetMessage*)m)->Title.Value << std::endl;
    }

    return m;
}

MessageFactory::~MessageFactory()
{
    //dtor
}
